<!-- html5 -->
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/template.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HappyMeal Management System</title>
</head>

<body>
<div id='all'>
  <div id='all-wrap'> 
    
    <!--header begin-->
    <div id='wrap-header'>
      <?php
			include 'header.php';
			//Forbid non-admin from adding a new meal comment
			if($_SESSION['is_admin'] == 0){
				// Do not allow to add meal
				header("Refresh: 2;url=restaurant_comment.php");
   				die("Restaurant is not allowed to add restaurant comment. Click <a href='restaurant_comment.php'>here</a> if your browser cannot redirect");
			}
		?>
    </div>
    <!--header end--> 
    
    <!--wrap-body begin-->
    <div id='wrap-body'> 
      <!-- wrap-search begin-->
      <div id='wrap-search'> </div>
      <!-- wrap-search end--> 
      
      <!-- wrap-content begin-->
      <div id='wrap-content'>
        <div id='nav' style="padding-left:30px;">
          <h4>Current : <a href='main.php'>Main</a>
            <?php include 'nav_png.php'; ?>
            <a href='restaurant_comment.php'>Restaurant Comment</a>
            <?php include 'nav_png.php'; ?>
            Restaurant Comment Add</h4>
        </div>
        <!-- partner_add begin-->
        <div id='partner_add'>
          <form action='restaurant_comment.php' method='post' id='restaurant_comment_add_form' enctype="multipart/form-data">
            <h3 style='padding-left:50px'>Please enter the information of a new meal comment.</h3>
            <table>
              
              <!-- Restaurant Selection -->
              <tr>
                <td width="150sp">User:</td>
                <td><select name='user'>
                    <option value=''>----SELECT----</option>
                    <?php
						$sql_partner = "SELECT * FROM user ORDER BY name ASC";
						$result_partner = mysql_query($sql_partner);
						while($row = mysql_fetch_array($result_partner)){
							echo "<option value='".$row['id']."'>".$row['name']."</option>";
						}
					?>
                  </select></td>
              </tr>
              
              <!-- Meal -->
              <tr>
                <td width="150sp">Restaurant:</td>
                <td><select name='restaurant'>
                    <option value=''>----SELECT----</option>
                    <?php
						$sql_partner = "SELECT * FROM restaurant WHERE is_admin='0' ORDER BY name ASC";
						$result_partner = mysql_query($sql_partner);
						while($row = mysql_fetch_array($result_partner)){
							echo "<option value='".$row['id']."'>".$row['name']."</option>";
						}
					?>
                  </select></td>
              </tr>
              
              <!-- Rating -->
              <tr>
                <td width="150sp">Rating:</td>
                <td><input type='number' name='rating' min="1" max="5"></td>
              </tr>
              
              <!-- Comment -->
              <tr>
                <td width="150sp">Comment:</td>
                <td><textarea rows="4" cols="50" name="comment" form="restaurant_comment_add_form"></textarea></td>
              </tr>
              
              <!-- Is blocked? -->
              <tr>
                <td width="150sp">Blocked? :</td>
                <td><select name='is_blocked'>
                    <option value=''>----SELECT----</option>
                    <option value='0'>NO</option>
                    <option value='1'>YES</option>
                  </select></td>
              </tr>
              
              <!-- Submit -->
              <tr>
                <td></td>
                <td align="left"><input type='submit' name='restaurant_comment_add' value='Add' onclick="return promptConfirm()">
                  <input type='button' name='user_cancel' value='Cancel' onclick='window.location="restaurant_comment.php";' /></td>
              </tr>
            </table>
          </form>
        </div>
        <!-- restaurant_comment_add end --> 
      </div>
      <!-- wrap-content end--> 
      
    </div>
    <!--wrap-body end--> 
    
    <!--wrap-footer begin-->
    <div id='wrap-footer'>
      <?php
			include 'footer.php';
		?>
    </div>
    <!--wrap-footer end--> 
    
  </div>
  <!-- all-wrap end--> 
</div>
<!-- all end-->
</body>
</html>